#include<stdio.h>
int main()
{
	int heads, feet;
	scanf("%d %d", &heads, &feet);
	int a, b;
	a = (4*heads - feet)/2;
	b = heads - a;
	printf("%d %d", a, b);
	
	return 0;
}
